home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-25 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  48.4 KB  |  1,178 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Screen Lines,  Next: List Motion,  Prev: Text Lines,  Up: Motion
  46.  
  47. Motion by Screen Lines
  48. ----------------------
  49.  
  50.    The line functions in the previous section count text lines,
  51. delimited only by newline characters.  By contrast, these functions
  52. count screen lines, which are defined by the way the text appears on
  53. the screen.  A text line is a single screen line if it is short enough
  54. to fit the width of the selected window, but otherwise it may occupy
  55. several screen lines.
  56.  
  57.    In some cases, text lines are truncated on the screen rather than
  58. continued onto additional screen lines.  In these cases,
  59. `vertical-motion' moves point much like `forward-line'.  *Note
  60. Truncation::.
  61.  
  62.    Because the width of a given string depends on the flags that control
  63. the appearance of certain characters, `vertical-motion' behaves
  64. differently, for a given piece of text, depending on the buffer it is
  65. in, and even on the selected window (because the width, the truncation
  66. flag, and display table may vary between windows).  *Note Usual
  67. Display::.
  68.  
  69.    These functions scan text to determine where screen lines break, and
  70. thus take time proportional to the distance scanned.  If you intend to
  71. use them heavily, Emacs provides caches which may improve the
  72. performance of your code.  *Note cache-long-line-scans: Text Lines.
  73.  
  74.  - Function: vertical-motion COUNT &optional WINDOW
  75.      This function moves point to the start of the screen line COUNT
  76.      screen lines down from the screen line containing point.  If COUNT
  77.      is negative, it moves up instead.
  78.  
  79.      `vertical-motion' returns the number of lines moved.  The value may
  80.      be less in absolute value than COUNT if the beginning or end of
  81.      the buffer was reached.
  82.  
  83.      The window WINDOW is used for obtaining parameters such as the
  84.      width, the horizontal scrolling, and the display table.  But
  85.      `vertical-motion' always operates on the current buffer, even if
  86.      WINDOW currently displays some other buffer.
  87.  
  88.  - Command: move-to-window-line COUNT
  89.      This function moves point with respect to the text currently
  90.      displayed in the selected window.  It moves point to the beginning
  91.      of the screen line COUNT screen lines from the top of the window.
  92.      If COUNT is negative, that specifies a position -COUNT lines from
  93.      the bottom (or the last line of the buffer, if the buffer ends
  94.      above the specified screen position).
  95.  
  96.      If COUNT is `nil', then point moves to the beginning of the line
  97.      in the middle of the window.  If the absolute value of COUNT is
  98.      greater than the size of the window, then point moves to the place
  99.      that would appear on that screen line if the window were tall
  100.      enough.  This will probably cause the next redisplay to scroll to
  101.      bring that location onto the screen.
  102.  
  103.      In an interactive call, COUNT is the numeric prefix argument.
  104.  
  105.      The value returned is the window line number point has moved to,
  106.      with the top line in the window numbered 0.
  107.  
  108. 
  109. File: lispref.info,  Node: List Motion,  Next: Skipping Characters,  Prev: Screen Lines,  Up: Motion
  110.  
  111. Moving over Balanced Expressions
  112. --------------------------------
  113.  
  114.    Here are several functions concerned with balanced-parenthesis
  115. expressions (also called "sexps" in connection with moving across them
  116. in XEmacs).  The syntax table controls how these functions interpret
  117. various characters; see *Note Syntax Tables::.  *Note Parsing
  118. Expressions::, for lower-level primitives for scanning sexps or parts of
  119. sexps.  For user-level commands, see *Note Lists and Sexps:
  120. (emacs)Lists and Sexps.
  121.  
  122.  - Command: forward-list ARG
  123.      This function moves forward across ARG balanced groups of
  124.      parentheses.  (Other syntactic entities such as words or paired
  125.      string quotes are ignored.)
  126.  
  127.  - Command: backward-list ARG
  128.      This function moves backward across ARG balanced groups of
  129.      parentheses.  (Other syntactic entities such as words or paired
  130.      string quotes are ignored.)
  131.  
  132.  - Command: up-list ARG
  133.      This function moves forward out of ARG levels of parentheses.  A
  134.      negative argument means move backward but still to a less deep
  135.      spot.
  136.  
  137.  - Command: down-list ARG
  138.      This function moves forward into ARG levels of parentheses.  A
  139.      negative argument means move backward but still go deeper in
  140.      parentheses (-ARG levels).
  141.  
  142.  - Command: forward-sexp ARG
  143.      This function moves forward across ARG balanced expressions.
  144.      Balanced expressions include both those delimited by parentheses
  145.      and other kinds, such as words and string constants.  For example,
  146.  
  147.           ---------- Buffer: foo ----------
  148.           (concat-!- "foo " (car x) y z)
  149.           ---------- Buffer: foo ----------
  150.           
  151.           (forward-sexp 3)
  152.                => nil
  153.           
  154.           ---------- Buffer: foo ----------
  155.           (concat "foo " (car x) y-!- z)
  156.           ---------- Buffer: foo ----------
  157.  
  158.  - Command: backward-sexp ARG
  159.      This function moves backward across ARG balanced expressions.
  160.  
  161.  - Command: beginning-of-defun ARG
  162.      This function moves back to the ARGth beginning of a defun.  If
  163.      ARG is negative, this actually moves forward, but it still moves
  164.      to the beginning of a defun, not to the end of one.
  165.  
  166.  - Command: end-of-defun ARG
  167.      This function moves forward to the ARGth end of a defun.  If ARG
  168.      is negative, this actually moves backward, but it still moves to
  169.      the end of a defun, not to the beginning of one.
  170.  
  171.  - User Option: defun-prompt-regexp
  172.      If non-`nil', this variable holds a regular expression that
  173.      specifies what text can appear before the open-parenthesis that
  174.      starts a defun.  That is to say, a defun begins on a line that
  175.      starts with a match for this regular expression, followed by a
  176.      character with open-parenthesis syntax.
  177.  
  178. 
  179. File: lispref.info,  Node: Skipping Characters,  Prev: List Motion,  Up: Motion
  180.  
  181. Skipping Characters
  182. -------------------
  183.  
  184.    The following two functions move point over a specified set of
  185. characters.  For example, they are often used to skip whitespace.  For
  186. related functions, see *Note Motion and Syntax::.
  187.  
  188.  - Function: skip-chars-forward CHARACTER-SET &optional LIMIT
  189.      This function moves point in the current buffer forward, skipping
  190.      over a given set of characters.  It examines the character
  191.      following point, then advances point if the character matches
  192.      CHARACTER-SET.  This continues until it reaches a character that
  193.      does not match.  The function returns `nil'.
  194.  
  195.      The argument CHARACTER-SET is like the inside of a `[...]' in a
  196.      regular expression except that `]' is never special and `\' quotes
  197.      `^', `-' or `\'.  Thus, `"a-zA-Z"' skips over all letters,
  198.      stopping before the first nonletter, and `"^a-zA-Z'" skips
  199.      nonletters stopping before the first letter.  *Note Regular
  200.      Expressions::.
  201.  
  202.      If LIMIT is supplied (it must be a number or a marker), it
  203.      specifies the maximum position in the buffer that point can be
  204.      skipped to.  Point will stop at or before LIMIT.
  205.  
  206.      In the following example, point is initially located directly
  207.      before the `T'.  After the form is evaluated, point is located at
  208.      the end of that line (between the `t' of `hat' and the newline).
  209.      The function skips all letters and spaces, but not newlines.
  210.  
  211.           ---------- Buffer: foo ----------
  212.           I read "-!-The cat in the hat
  213.           comes back" twice.
  214.           ---------- Buffer: foo ----------
  215.           
  216.           (skip-chars-forward "a-zA-Z ")
  217.                => nil
  218.           
  219.           ---------- Buffer: foo ----------
  220.           I read "The cat in the hat-!-
  221.           comes back" twice.
  222.           ---------- Buffer: foo ----------
  223.  
  224.  - Function: skip-chars-backward CHARACTER-SET &optional LIMIT
  225.      This function moves point backward, skipping characters that match
  226.      CHARACTER-SET, until LIMIT.  It just like `skip-chars-forward'
  227.      except for the direction of motion.
  228.  
  229. 
  230. File: lispref.info,  Node: Excursions,  Next: Narrowing,  Prev: Motion,  Up: Positions
  231.  
  232. Excursions
  233. ==========
  234.  
  235.    It is often useful to move point "temporarily" within a localized
  236. portion of the program, or to switch buffers temporarily.  This is
  237. called an "excursion", and it is done with the `save-excursion' special
  238. form.  This construct saves the current buffer and its values of point
  239. and the mark so they can be restored after the completion of the
  240. excursion.
  241.  
  242.    The forms for saving and restoring the configuration of windows are
  243. described elsewhere (see *Note Window Configurations::).
  244.  
  245.  - Special Form: save-excursion FORMS...
  246.      The `save-excursion' special form saves the identity of the current
  247.      buffer and the values of point and the mark in it, evaluates
  248.      FORMS, and finally restores the buffer and its saved values of
  249.      point and the mark.  All three saved values are restored even in
  250.      case of an abnormal exit via `throw' or error (*note Nonlocal
  251.      Exits::.).
  252.  
  253.      The `save-excursion' special form is the standard way to switch
  254.      buffers or move point within one part of a program and avoid
  255.      affecting the rest of the program.  It is used more than 500 times
  256.      in the Lisp sources of XEmacs.
  257.  
  258.      `save-excursion' does not save the values of point and the mark for
  259.      other buffers, so changes in other buffers remain in effect after
  260.      `save-excursion' exits.
  261.  
  262.      Likewise, `save-excursion' does not restore window-buffer
  263.      correspondences altered by functions such as `switch-to-buffer'.
  264.      One way to restore these correspondences, and the selected window,
  265.      is to use `save-window-excursion' inside `save-excursion' (*note
  266.      Window Configurations::.).
  267.  
  268.      The value returned by `save-excursion' is the result of the last of
  269.      FORMS, or `nil' if no FORMS are given.
  270.  
  271.           (save-excursion
  272.             FORMS)
  273.           ==
  274.           (let ((old-buf (current-buffer))
  275.                 (old-pnt (point-marker))
  276.                 (old-mark (copy-marker (mark-marker))))
  277.             (unwind-protect
  278.                 (progn FORMS)
  279.               (set-buffer old-buf)
  280.               (goto-char old-pnt)
  281.               (set-marker (mark-marker) old-mark)))
  282.  
  283. 
  284. File: lispref.info,  Node: Narrowing,  Prev: Excursions,  Up: Positions
  285.  
  286. Narrowing
  287. =========
  288.  
  289.    "Narrowing" means limiting the text addressable by XEmacs editing
  290. commands to a limited range of characters in a buffer.  The text that
  291. remains addressable is called the "accessible portion" of the buffer.
  292.  
  293.    Narrowing is specified with two buffer positions which become the
  294. beginning and end of the accessible portion.  For most editing commands
  295. and most Emacs primitives, these positions replace the values of the
  296. beginning and end of the buffer.  While narrowing is in effect, no text
  297. outside the accessible portion is displayed, and point cannot move
  298. outside the accessible portion.
  299.  
  300.    Values such as positions or line numbers, which usually count from
  301. the beginning of the buffer, do so despite narrowing, but the functions
  302. which use them refuse to operate on text that is inaccessible.
  303.  
  304.    The commands for saving buffers are unaffected by narrowing; they
  305. save the entire buffer regardless of any narrowing.
  306.  
  307.  - Command: narrow-to-region START END
  308.      This function sets the accessible portion of the current buffer to
  309.      start at START and end at END.  Both arguments should be character
  310.      positions.
  311.  
  312.      In an interactive call, START and END are set to the bounds of the
  313.      current region (point and the mark, with the smallest first).
  314.  
  315.  - Command: narrow-to-page MOVE-COUNT
  316.      This function sets the accessible portion of the current buffer to
  317.      include just the current page.  An optional first argument
  318.      MOVE-COUNT non-`nil' means to move forward or backward by
  319.      MOVE-COUNT pages and then narrow.  The variable `page-delimiter'
  320.      specifies where pages start and end (*note Standard Regexps::.).
  321.  
  322.      In an interactive call, MOVE-COUNT is set to the numeric prefix
  323.      argument.
  324.  
  325.  - Command: widen
  326.      This function cancels any narrowing in the current buffer, so that
  327.      the entire contents are accessible.  This is called "widening".
  328.      It is equivalent to the following expression:
  329.  
  330.           (narrow-to-region 1 (1+ (buffer-size)))
  331.  
  332.  - Special Form: save-restriction BODY...
  333.      This special form saves the current bounds of the accessible
  334.      portion, evaluates the BODY forms, and finally restores the saved
  335.      bounds, thus restoring the same state of narrowing (or absence
  336.      thereof) formerly in effect.  The state of narrowing is restored
  337.      even in the event of an abnormal exit via `throw' or error (*note
  338.      Nonlocal Exits::.).  Therefore, this construct is a clean way to
  339.      narrow a buffer temporarily.
  340.  
  341.      The value returned by `save-restriction' is that returned by the
  342.      last form in BODY, or `nil' if no body forms were given.
  343.  
  344.      *Caution:* it is easy to make a mistake when using the
  345.      `save-restriction' construct.  Read the entire description here
  346.      before you try it.
  347.  
  348.      If BODY changes the current buffer, `save-restriction' still
  349.      restores the restrictions on the original buffer (the buffer whose
  350.      restructions it saved from), but it does not restore the identity
  351.      of the current buffer.
  352.  
  353.      `save-restriction' does *not* restore point and the mark; use
  354.      `save-excursion' for that.  If you use both `save-restriction' and
  355.      `save-excursion' together, `save-excursion' should come first (on
  356.      the outside).  Otherwise, the old point value would be restored
  357.      with temporary narrowing still in effect.  If the old point value
  358.      were outside the limits of the temporary narrowing, this would
  359.      fail to restore it accurately.
  360.  
  361.      The `save-restriction' special form records the values of the
  362.      beginning and end of the accessible portion as distances from the
  363.      beginning and end of the buffer.  In other words, it records the
  364.      amount of inaccessible text before and after the accessible
  365.      portion.
  366.  
  367.      This method yields correct results if BODY does further narrowing.
  368.      However, `save-restriction' can become confused if the body widens
  369.      and then make changes outside the range of the saved narrowing.
  370.      When this is what you want to do, `save-restriction' is not the
  371.      right tool for the job.  Here is what you must use instead:
  372.  
  373.           (let ((beg (point-min-marker))
  374.                 (end (point-max-marker)))
  375.             (unwind-protect
  376.                 (progn BODY)
  377.               (save-excursion
  378.                 (set-buffer (marker-buffer beg))
  379.                 (narrow-to-region beg end))))
  380.  
  381.      Here is a simple example of correct use of `save-restriction':
  382.  
  383.           ---------- Buffer: foo ----------
  384.           This is the contents of foo
  385.           This is the contents of foo
  386.           This is the contents of foo-!-
  387.           ---------- Buffer: foo ----------
  388.           
  389.           (save-excursion
  390.             (save-restriction
  391.               (goto-char 1)
  392.               (forward-line 2)
  393.               (narrow-to-region 1 (point))
  394.               (goto-char (point-min))
  395.               (replace-string "foo" "bar")))
  396.           
  397.           ---------- Buffer: foo ----------
  398.           This is the contents of bar
  399.           This is the contents of bar
  400.           This is the contents of foo-!-
  401.           ---------- Buffer: foo ----------
  402.  
  403. 
  404. File: lispref.info,  Node: Markers,  Next: Text,  Prev: Positions,  Up: Top
  405.  
  406. Markers
  407. *******
  408.  
  409.    A "marker" is a Lisp object used to specify a position in a buffer
  410. relative to the surrounding text.  A marker changes its offset from the
  411. beginning of the buffer automatically whenever text is inserted or
  412. deleted, so that it stays with the two characters on either side of it.
  413.  
  414. * Menu:
  415.  
  416. * Overview of Markers::      The components of a marker, and how it relocates.
  417. * Predicates on Markers::    Testing whether an object is a marker.
  418. * Creating Markers::         Making empty markers or markers at certain places.
  419. * Information from Markers:: Finding the marker's buffer or character position.
  420. * Changing Markers::         Moving the marker to a new buffer or position.
  421. * The Mark::                 How "the mark" is implemented with a marker.
  422. * The Region::               How to access "the region".
  423.  
  424. 
  425. File: lispref.info,  Node: Overview of Markers,  Next: Predicates on Markers,  Up: Markers
  426.  
  427. Overview of Markers
  428. ===================
  429.  
  430.    A marker specifies a buffer and a position in that buffer.  The
  431. marker can be used to represent a position in the functions that
  432. require one, just as an integer could be used.  *Note Positions::, for
  433. a complete description of positions.
  434.  
  435.    A marker has two attributes: the marker position, and the marker
  436. buffer.  The marker position is an integer that is equivalent (at a
  437. given time) to the marker as a position in that buffer.  But the
  438. marker's position value can change often during the life of the marker.
  439. Insertion and deletion of text in the buffer relocate the marker.  The
  440. idea is that a marker positioned between two characters remains between
  441. those two characters despite insertion and deletion elsewhere in the
  442. buffer.  Relocation changes the integer equivalent of the marker.
  443.  
  444.    Deleting text around a marker's position leaves the marker between
  445. the characters immediately before and after the deleted text.  Inserting
  446. text at the position of a marker normally leaves the marker in front of
  447. the new text--unless it is inserted with `insert-before-markers' (*note
  448. Insertion::.).
  449.  
  450.    Insertion and deletion in a buffer must check all the markers and
  451. relocate them if necessary.  This slows processing in a buffer with a
  452. large number of markers.  For this reason, it is a good idea to make a
  453. marker point nowhere if you are sure you don't need it any more.
  454. Unreferenced markers are garbage collected eventually, but until then
  455. will continue to use time if they do point somewhere.
  456.  
  457.    Because it is common to perform arithmetic operations on a marker
  458. position, most of the arithmetic operations (including `+' and `-')
  459. accept markers as arguments.  In such cases, the marker stands for its
  460. current position.
  461.  
  462.    Here are examples of creating markers, setting markers, and moving
  463. point to markers:
  464.  
  465.      ;; Make a new marker that initially does not point anywhere:
  466.      (setq m1 (make-marker))
  467.           => #<marker in no buffer>
  468.      
  469.      ;; Set `m1' to point between the 99th and 100th characters
  470.      ;;   in the current buffer:
  471.      (set-marker m1 100)
  472.           => #<marker at 100 in markers.texi>
  473.      
  474.      ;; Now insert one character at the beginning of the buffer:
  475.      (goto-char (point-min))
  476.           => 1
  477.      (insert "Q")
  478.           => nil
  479.      
  480.      ;; `m1' is updated appropriately.
  481.      m1
  482.           => #<marker at 101 in markers.texi>
  483.      
  484.      ;; Two markers that point to the same position
  485.      ;;   are not `eq', but they are `equal'.
  486.      (setq m2 (copy-marker m1))
  487.           => #<marker at 101 in markers.texi>
  488.      (eq m1 m2)
  489.           => nil
  490.      (equal m1 m2)
  491.           => t
  492.      
  493.      ;; When you are finished using a marker, make it point nowhere.
  494.      (set-marker m1 nil)
  495.           => #<marker in no buffer>
  496.  
  497. 
  498. File: lispref.info,  Node: Predicates on Markers,  Next: Creating Markers,  Prev: Overview of Markers,  Up: Markers
  499.  
  500. Predicates on Markers
  501. =====================
  502.  
  503.    You can test an object to see whether it is a marker, or whether it
  504. is either an integer or a marker.  The latter test is useful in
  505. connection with the arithmetic functions that work with both markers
  506. and integers.
  507.  
  508.  - Function: markerp OBJECT
  509.      This function returns `t' if OBJECT is a marker, `nil' otherwise.
  510.      Note that integers are not markers, even though many functions
  511.      will accept either a marker or an integer.
  512.  
  513.  - Function: integer-or-marker-p OBJECT
  514.      This function returns `t' if OBJECT is an integer or a marker,
  515.      `nil' otherwise.
  516.  
  517.  - Function: number-or-marker-p OBJECT
  518.      This function returns `t' if OBJECT is a number (either kind) or a
  519.      marker, `nil' otherwise.
  520.  
  521. 
  522. File: lispref.info,  Node: Creating Markers,  Next: Information from Markers,  Prev: Predicates on Markers,  Up: Markers
  523.  
  524. Functions That Create Markers
  525. =============================
  526.  
  527.    When you create a new marker, you can make it point nowhere, or point
  528. to the present position of point, or to the beginning or end of the
  529. accessible portion of the buffer, or to the same place as another given
  530. marker.
  531.  
  532.  - Function: make-marker
  533.      This functions returns a newly created marker that does not point
  534.      anywhere.
  535.  
  536.           (make-marker)
  537.                => #<marker in no buffer>
  538.  
  539.  - Function: point-marker
  540.      This function returns a new marker that points to the present
  541.      position of point in the current buffer.  *Note Point::.  For an
  542.      example, see `copy-marker', below.
  543.  
  544.  - Function: point-min-marker
  545.      This function returns a new marker that points to the beginning of
  546.      the accessible portion of the buffer.  This will be the beginning
  547.      of the buffer unless narrowing is in effect.  *Note Narrowing::.
  548.  
  549.  - Function: point-max-marker
  550.      This function returns a new marker that points to the end of the
  551.      accessible portion of the buffer.  This will be the end of the
  552.      buffer unless narrowing is in effect.  *Note Narrowing::.
  553.  
  554.      Here are examples of this function and `point-min-marker', shown in
  555.      a buffer containing a version of the source file for the text of
  556.      this chapter.
  557.  
  558.           (point-min-marker)
  559.                => #<marker at 1 in markers.texi>
  560.           (point-max-marker)
  561.                => #<marker at 15573 in markers.texi>
  562.           
  563.           (narrow-to-region 100 200)
  564.                => nil
  565.           (point-min-marker)
  566.                => #<marker at 100 in markers.texi>
  567.           (point-max-marker)
  568.                => #<marker at 200 in markers.texi>
  569.  
  570.  - Function: copy-marker MARKER-OR-INTEGER
  571.      If passed a marker as its argument, `copy-marker' returns a new
  572.      marker that points to the same place and the same buffer as does
  573.      MARKER-OR-INTEGER.  If passed an integer as its argument,
  574.      `copy-marker' returns a new marker that points to position
  575.      MARKER-OR-INTEGER in the current buffer.
  576.  
  577.      If passed an integer argument less than 1, `copy-marker' returns a
  578.      new marker that points to the beginning of the current buffer.  If
  579.      passed an integer argument greater than the length of the buffer,
  580.      `copy-marker' returns a new marker that points to the end of the
  581.      buffer.
  582.  
  583.      An error is signaled if MARKER is neither a marker nor an integer.
  584.  
  585.           (setq p (point-marker))
  586.                => #<marker at 2139 in markers.texi>
  587.           
  588.           (setq q (copy-marker p))
  589.                => #<marker at 2139 in markers.texi>
  590.           
  591.           (eq p q)
  592.                => nil
  593.           
  594.           (equal p q)
  595.                => t
  596.           
  597.           (copy-marker 0)
  598.                => #<marker at 1 in markers.texi>
  599.           
  600.           (copy-marker 20000)
  601.                => #<marker at 7572 in markers.texi>
  602.  
  603. 
  604. File: lispref.info,  Node: Information from Markers,  Next: Changing Markers,  Prev: Creating Markers,  Up: Markers
  605.  
  606. Information from Markers
  607. ========================
  608.  
  609.    This section describes the functions for accessing the components of
  610. a marker object.
  611.  
  612.  - Function: marker-position MARKER
  613.      This function returns the position that MARKER points to, or `nil'
  614.      if it points nowhere.
  615.  
  616.  - Function: marker-buffer MARKER
  617.      This function returns the buffer that MARKER points into, or `nil'
  618.      if it points nowhere.
  619.  
  620.           (setq m (make-marker))
  621.                => #<marker in no buffer>
  622.           (marker-position m)
  623.                => nil
  624.           (marker-buffer m)
  625.                => nil
  626.           
  627.           (set-marker m 3770 (current-buffer))
  628.                => #<marker at 3770 in markers.texi>
  629.           (marker-buffer m)
  630.                => #<buffer markers.texi>
  631.           (marker-position m)
  632.                => 3770
  633.  
  634.    Two distinct markers are considered `equal' (even though not `eq')
  635. to each other if they have the same position and buffer, or if they
  636. both point nowhere.
  637.  
  638. 
  639. File: lispref.info,  Node: Changing Markers,  Next: The Mark,  Prev: Information from Markers,  Up: Markers
  640.  
  641. Changing Marker Positions
  642. =========================
  643.  
  644.    This section describes how to change the position of an existing
  645. marker.  When you do this, be sure you know whether the marker is used
  646. outside of your program, and, if so, what effects will result from
  647. moving it--otherwise, confusing things may happen in other parts of
  648. Emacs.
  649.  
  650.  - Function: set-marker MARKER POSITION &optional BUFFER
  651.      This function moves MARKER to POSITION in BUFFER.  If BUFFER is
  652.      not provided, it defaults to the current buffer.
  653.  
  654.      If POSITION is less than 1, `set-marker' moves MARKER to the
  655.      beginning of the buffer.  If POSITION is greater than the size of
  656.      the buffer, `set-marker' moves marker to the end of the buffer.
  657.      If POSITION is `nil' or a marker that points nowhere, then MARKER
  658.      is set to point nowhere.
  659.  
  660.      The value returned is MARKER.
  661.  
  662.           (setq m (point-marker))
  663.                => #<marker at 4714 in markers.texi>
  664.           (set-marker m 55)
  665.                => #<marker at 55 in markers.texi>
  666.           (setq b (get-buffer "foo"))
  667.                => #<buffer foo>
  668.           (set-marker m 0 b)
  669.                => #<marker at 1 in foo>
  670.  
  671.  - Function: move-marker MARKER POSITION &optional BUFFER
  672.      This is another name for `set-marker'.
  673.  
  674. 
  675. File: lispref.info,  Node: The Mark,  Next: The Region,  Prev: Changing Markers,  Up: Markers
  676.  
  677. The Mark
  678. ========
  679.  
  680.    One special marker in each buffer is designated "the mark".  It
  681. records a position for the user for the sake of commands such as `C-w'
  682. and `C-x TAB'.  Lisp programs should set the mark only to values that
  683. have a potential use to the user, and never for their own internal
  684. purposes.  For example, the `replace-regexp' command sets the mark to
  685. the value of point before doing any replacements, because this enables
  686. the user to move back there conveniently after the replace is finished.
  687.  
  688.    Many commands are designed so that when called interactively they
  689. operate on the text between point and the mark.  If you are writing such
  690. a command, don't examine the mark directly; instead, use `interactive'
  691. with the `r' specification.  This provides the values of point and the
  692. mark as arguments to the command in an interactive call, but permits
  693. other Lisp programs to specify arguments explicitly.  *Note Interactive
  694. Codes::.
  695.  
  696.    Each buffer has its own value of the mark that is independent of the
  697. value of the mark in other buffers.  When a buffer is created, the mark
  698. exists but does not point anywhere.  We consider this state as "the
  699. absence of a mark in that buffer."
  700.  
  701.    Once the mark "exists" in a buffer, it normally never ceases to
  702. exist.  However, it may become "inactive", if Transient Mark mode is
  703. enabled.  The variable `mark-active', which is always local in all
  704. buffers, indicates whether the mark is active: non-`nil' means yes.  A
  705. command can request deactivation of the mark upon return to the editor
  706. command loop by setting `deactivate-mark' to a non-`nil' value (but
  707. this causes deactivation only if Transient Mark mode is enabled).
  708.  
  709.    The main motivation for using Transient Mark mode is that this mode
  710. also enables highlighting of the region when the mark is active.  *Note
  711. Display::.
  712.  
  713.    In addition to the mark, each buffer has a "mark ring" which is a
  714. list of markers containing previous values of the mark.  When editing
  715. commands change the mark, they should normally save the old value of the
  716. mark on the mark ring.  The variable `mark-ring-max' specifies the
  717. maximum number of entries in the mark ring; once the list becomes this
  718. long, adding a new element deletes the last element.
  719.  
  720.  - Function: mark &optional FORCE
  721.      This function returns the current buffer's mark position as an
  722.      integer.
  723.  
  724.      If the mark is inactive, `mark' normally signals an error.
  725.      However, if FORCE is non-`nil', then `mark' returns the mark
  726.      position anyway--or `nil', if the mark is not yet set for this
  727.      buffer.
  728.  
  729.  - Function: mark-marker
  730.      This function returns the current buffer's mark.  This is the very
  731.      marker that records the mark location inside XEmacs, not a copy.
  732.      Therefore, changing this marker's position will directly affect
  733.      the position of the mark.  Don't do it unless that is the effect
  734.      you want.
  735.  
  736.           (setq m (mark-marker))
  737.                => #<marker at 3420 in markers.texi>
  738.           (set-marker m 100)
  739.                => #<marker at 100 in markers.texi>
  740.           (mark-marker)
  741.                => #<marker at 100 in markers.texi>
  742.  
  743.      Like any marker, this marker can be set to point at any buffer you
  744.      like.  We don't recommend that you make it point at any buffer
  745.      other than the one of which it is the mark.  If you do, it will
  746.      yield perfectly consistent, but rather odd, results.
  747.  
  748.  - Function: set-mark POSITION
  749.      This function sets the mark to POSITION, and activates the mark.
  750.      The old value of the mark is *not* pushed onto the mark ring.
  751.  
  752.      *Please note:* Use this function only if you want the user to see
  753.      that the mark has moved, and you want the previous mark position to
  754.      be lost.  Normally, when a new mark is set, the old one should go
  755.      on the `mark-ring'.  For this reason, most applications should use
  756.      `push-mark' and `pop-mark', not `set-mark'.
  757.  
  758.      Novice Emacs Lisp programmers often try to use the mark for the
  759.      wrong purposes.  The mark saves a location for the user's
  760.      convenience.  An editing command should not alter the mark unless
  761.      altering the mark is part of the user-level functionality of the
  762.      command.  (And, in that case, this effect should be documented.)
  763.      To remember a location for internal use in the Lisp program, store
  764.      it in a Lisp variable.  For example:
  765.  
  766.           (let ((beg (point)))
  767.             (forward-line 1)
  768.             (delete-region beg (point))).
  769.  
  770.  - Function: push-mark &optional POSITION NOMSG ACTIVATE
  771.      This function sets the current buffer's mark to POSITION, and
  772.      pushes a copy of the previous mark onto `mark-ring'.  If POSITION
  773.      is `nil', then the value of point is used.  `push-mark' returns
  774.      `nil'.
  775.  
  776.      The function `push-mark' normally *does not* activate the mark.
  777.      To do that, specify `t' for the argument ACTIVATE.
  778.  
  779.      A `Mark set' message is displayed unless NOMSG is non-`nil'.
  780.  
  781.  - Function: pop-mark
  782.      This function pops off the top element of `mark-ring' and makes
  783.      that mark become the buffer's actual mark.  This does not move
  784.      point in the buffer, and it does nothing if `mark-ring' is empty.
  785.      It deactivates the mark.
  786.  
  787.      The return value is not meaningful.
  788.  
  789.  - User Option: transient-mark-mode
  790.      This variable if non-`nil' enables Transient Mark mode, in which
  791.      every buffer-modifying primitive sets `deactivate-mark'.  The
  792.      consequence of this is that commands that modify the buffer
  793.      normally make the mark inactive.
  794.  
  795.  - Variable: deactivate-mark
  796.      If an editor command sets this variable non-`nil', then the editor
  797.      command loop deactivates the mark after the command returns, but
  798.      only if Transient Mark mode is enabled.
  799.  
  800.  - Function: deactivate-mark
  801.      This function deactivates the mark, but only if Transient Mark mode
  802.      is enabled.
  803.  
  804.  - Variable: mark-active
  805.      The mark is active when this variable is non-`nil'.  This variable
  806.      is always local in each buffer.
  807.  
  808.  - Variable: activate-mark-hook
  809.  - Variable: deactivate-mark-hook
  810.      These normal hooks are run, respectively, when the mark becomes
  811.      active and when it becomes inactive.  The hook
  812.      `activate-mark-hook' is also run at the end of a command if the
  813.      mark is active and the region may have changed.
  814.  
  815.  - Variable: mark-ring
  816.      The value of this buffer-local variable is the list of saved former
  817.      marks of the current buffer, most recent first.
  818.  
  819.           mark-ring
  820.           => (#<marker at 11050 in markers.texi>
  821.               #<marker at 10832 in markers.texi>
  822.               ...)
  823.  
  824.  - User Option: mark-ring-max
  825.      The value of this variable is the maximum size of `mark-ring'.  If
  826.      more marks than this are pushed onto the `mark-ring', `push-mark'
  827.      discards an old mark when it adds a new one.
  828.  
  829. 
  830. File: lispref.info,  Node: The Region,  Prev: The Mark,  Up: Markers
  831.  
  832. The Region
  833. ==========
  834.  
  835.    The text between point and the mark is known as "the region".
  836. Various functions operate on text delimited by point and the mark, but
  837. only those functions specifically related to the region itself are
  838. described here.
  839.  
  840.  - Function: region-beginning
  841.      This function returns the position of the beginning of the region
  842.      (as an integer).  This is the position of either point or the mark,
  843.      whichever is smaller.
  844.  
  845.      If the mark does not point anywhere, an error is signaled.
  846.  
  847.  - Function: region-end
  848.      This function returns the position of the end of the region (as an
  849.      integer).  This is the position of either point or the mark,
  850.      whichever is larger.
  851.  
  852.      If the mark does not point anywhere, an error is signaled.
  853.  
  854.    Few programs need to use the `region-beginning' and `region-end'
  855. functions.  A command designed to operate on a region should normally
  856. use `interactive' with the `r' specification to find the beginning and
  857. end of the region.  This lets other Lisp programs specify the bounds
  858. explicitly as arguments.  (*Note Interactive Codes::.)
  859.  
  860. 
  861. File: lispref.info,  Node: Text,  Next: Searching and Matching,  Prev: Markers,  Up: Top
  862.  
  863. Text
  864. ****
  865.  
  866.    This chapter describes the functions that deal with the text in a
  867. buffer.  Most examine, insert, or delete text in the current buffer,
  868. often in the vicinity of point.  Many are interactive.  All the
  869. functions that change the text provide for undoing the changes (*note
  870. Undo::.).
  871.  
  872.    Many text-related functions operate on a region of text defined by
  873. two buffer positions passed in arguments named START and END.  These
  874. arguments should be either markers (*note Markers::.) or numeric
  875. character positions (*note Positions::.).  The order of these arguments
  876. does not matter; it is all right for START to be the end of the region
  877. and END the beginning.  For example, `(delete-region 1 10)' and
  878. `(delete-region 10 1)' are equivalent.  An `args-out-of-range' error is
  879. signaled if either START or END is outside the accessible portion of
  880. the buffer.  In an interactive call, point and the mark are used for
  881. these arguments.
  882.  
  883.    Throughout this chapter, "text" refers to the characters in the
  884. buffer, together with their properties (when relevant).
  885.  
  886. * Menu:
  887.  
  888. * Near Point::       Examining text in the vicinity of point.
  889. * Buffer Contents::  Examining text in a general fashion.
  890. * Comparing Text::   Comparing substrings of buffers.
  891. * Insertion::        Adding new text to a buffer.
  892. * Commands for Insertion::  User-level commands to insert text.
  893. * Deletion::         Removing text from a buffer.
  894. * User-Level Deletion::     User-level commands to delete text.
  895. * The Kill Ring::    Where removed text sometimes is saved for later use.
  896. * Undo::             Undoing changes to the text of a buffer.
  897. * Maintaining Undo:: How to enable and disable undo information.
  898.             How to control how much information is kept.
  899. * Filling::          Functions for explicit filling.
  900. * Margins::          How to specify margins for filling commands.
  901. * Auto Filling::     How auto-fill mode is implemented to break lines.
  902. * Sorting::          Functions for sorting parts of the buffer.
  903. * Columns::          Computing horizontal positions, and using them.
  904. * Indentation::      Functions to insert or adjust indentation.
  905. * Case Changes::     Case conversion of parts of the buffer.
  906. * Text Properties::  Assigning Lisp property lists to text characters.
  907. * Substitution::     Replacing a given character wherever it appears.
  908. * Transposition::    Swapping two portions of a buffer.
  909. * Registers::        How registers are implemented.  Accessing the text or
  910.                        position stored in a register.
  911. * Change Hooks::     Supplying functions to be run when text is changed.
  912.  
  913. 
  914. File: lispref.info,  Node: Near Point,  Next: Buffer Contents,  Up: Text
  915.  
  916. Examining Text Near Point
  917. =========================
  918.  
  919.    Many functions are provided to look at the characters around point.
  920. Several simple functions are described here.  See also `looking-at' in
  921. *Note Regexp Search::.
  922.  
  923.    Many of these functions take an optional BUFFER argument.  In all
  924. such cases, the current buffer will be used if this argument is
  925. omitted. (In FSF Emacs, and earlier versions of XEmacs, these functions
  926. usually did not have these optional BUFFER arguments and always
  927. operated on the current buffer.)
  928.  
  929.  - Function: char-after POSITION &optional BUFFER
  930.      This function returns the character in the buffer at (i.e.,
  931.      immediately after) position POSITION.  If POSITION is out of range
  932.      for this purpose, either before the beginning of the buffer, or at
  933.      or beyond the end, then the value is `nil'.  If optional argument
  934.      BUFFER is `nil', the current buffer is assumed.
  935.  
  936.      In the following example, assume that the first character in the
  937.      buffer is `@':
  938.  
  939.           (char-to-string (char-after 1))
  940.                => "@"
  941.  
  942.  - Function: following-char &optional BUFFER
  943.      This function returns the character following point in the buffer.
  944.      This is similar to `(char-after (point))'.  However, if point is at
  945.      the end of the buffer, then the result of `following-char' is 0.
  946.      If optional argument BUFFER is `nil', the current buffer is
  947.      assumed.
  948.  
  949.      Remember that point is always between characters, and the terminal
  950.      cursor normally appears over the character following point.
  951.      Therefore, the character returned by `following-char' is the
  952.      character the cursor is over.
  953.  
  954.      In this example, point is between the `a' and the `c'.
  955.  
  956.           ---------- Buffer: foo ----------
  957.           Gentlemen may cry ``Pea-!-ce! Peace!,''
  958.           but there is no peace.
  959.           ---------- Buffer: foo ----------
  960.           
  961.           (char-to-string (preceding-char))
  962.                => "a"
  963.           (char-to-string (following-char))
  964.                => "c"
  965.  
  966.  - Function: preceding-char &optional BUFFER
  967.      This function returns the character preceding point in the buffer.
  968.      buffer.  See above, under `following-char', for an example.  If
  969.      point is at the beginning of the buffer, `preceding-char' returns
  970.      0.  If optional argument BUFFER is `nil', the current buffer is
  971.      assumed.
  972.  
  973.  - Function: bobp &optional BUFFER
  974.      This function returns `t' if point is at the beginning of the
  975.      buffer.  If narrowing is in effect, this means the beginning of the
  976.      accessible portion of the text.  If optional argument BUFFER is
  977.      `nil', the current buffer is assumed.  See also `point-min' in
  978.      *Note Point::.
  979.  
  980.  - Function: eobp &optional BUFFER
  981.      This function returns `t' if point is at the end of the buffer.
  982.      If narrowing is in effect, this means the end of accessible
  983.      portion of the text.  If optional argument BUFFER is `nil', the
  984.      current buffer is assumed.  See also `point-max' in *Note Point::.
  985.  
  986.  - Function: bolp &optional BUFFER
  987.      This function returns `t' if point is at the beginning of a line.
  988.      If optional argument BUFFER is `nil', the current buffer is
  989.      assumed.  *Note Text Lines::.  The beginning of the buffer (or its
  990.      accessible portion) always counts as the beginning of a line.
  991.  
  992.  - Function: eolp &optional BUFFER
  993.      This function returns `t' if point is at the end of a line.  The
  994.      end of the buffer is always considered the end of a line.  If
  995.      optional argument BUFFER is `nil', the current buffer is assumed.
  996.      The end of the buffer (or of its accessible portion) is always
  997.      considered the end of a line.
  998.  
  999. 
  1000. File: lispref.info,  Node: Buffer Contents,  Next: Comparing Text,  Prev: Near Point,  Up: Text
  1001.  
  1002. Examining Buffer Contents
  1003. =========================
  1004.  
  1005.    This section describes two functions that allow a Lisp program to
  1006. convert any portion of the text in the buffer into a string.
  1007.  
  1008.  - Function: buffer-substring START END &optional BUFFER
  1009.      This function returns a string containing a copy of the text of the
  1010.      region defined by positions START and END in the buffer.  If the
  1011.      arguments are not positions in the accessible portion of the
  1012.      buffer, `buffer-substring' signals an `args-out-of-range' error.
  1013.      If optional argument BUFFER is `nil', the current buffer is
  1014.      assumed.
  1015.  
  1016.      If the region delineated by START and END contains duplicable
  1017.      extents, they will be remembered in the string.*Note Duplicable
  1018.      Extents::.
  1019.  
  1020.      It is not necessary for START to be less than END; the arguments
  1021.      can be given in either order.  But most often the smaller argument
  1022.      is written first.
  1023.  
  1024.           ---------- Buffer: foo ----------
  1025.           This is the contents of buffer foo
  1026.           
  1027.           ---------- Buffer: foo ----------
  1028.           
  1029.           (buffer-substring 1 10)
  1030.           => "This is t"
  1031.           (buffer-substring (point-max) 10)
  1032.           => "he contents of buffer foo
  1033.           "
  1034.  
  1035.  - Function: buffer-substring-without-properties START END
  1036.      This is like `buffer-substring', except that it does not copy text
  1037.      properties, just the characters themselves.  *Note Text
  1038.      Properties::.  Here's an example of using this function to get a
  1039.      word to look up in an alist:
  1040.  
  1041.           (setq flammable
  1042.                 (assoc (buffer-substring start end)
  1043.                        '(("wood" . t) ("paper" . t)
  1044.                          ("steel" . nil) ("asbestos" . nil))))
  1045.  
  1046.      If this were written using `buffer-substring' instead, it would not
  1047.      work reliably; any text properties that happened to be in the word
  1048.      copied from the buffer would make the comparisons fail.
  1049.  
  1050.  - Function: buffer-string
  1051.      This function returns the contents of the accessible portion of the
  1052.      current buffer as a string.  This is the portion between
  1053.      `(point-min)' and `(point-max)' (*note Narrowing::.).
  1054.  
  1055.           ---------- Buffer: foo ----------
  1056.           This is the contents of buffer foo
  1057.           
  1058.           ---------- Buffer: foo ----------
  1059.           
  1060.           (buffer-string)
  1061.                => "This is the contents of buffer foo
  1062.           "
  1063.  
  1064. 
  1065. File: lispref.info,  Node: Comparing Text,  Next: Insertion,  Prev: Buffer Contents,  Up: Text
  1066.  
  1067. Comparing Text
  1068. ==============
  1069.  
  1070.    This function lets you compare portions of the text in a buffer,
  1071. without copying them into strings first.
  1072.  
  1073.  - Function: compare-buffer-substrings BUFFER1 START1 END1 BUFFER2
  1074.           START2 END2
  1075.      This function lets you compare two substrings of the same buffer
  1076.      or two different buffers.  The first three arguments specify one
  1077.      substring, giving a buffer and two positions within the buffer.
  1078.      The last three arguments specify the other substring in the same
  1079.      way.  You can use `nil' for BUFFER1, BUFFER2, or both to stand for
  1080.      the current buffer.
  1081.  
  1082.      The value is negative if the first substring is less, positive if
  1083.      the first is greater, and zero if they are equal.  The absolute
  1084.      value of the result is one plus the index of the first differing
  1085.      characters within the substrings.
  1086.  
  1087.      This function ignores case when comparing characters if
  1088.      `case-fold-search' is non-`nil'.  It always ignores text
  1089.      properties.
  1090.  
  1091.      Suppose the current buffer contains the text `foobarbar
  1092.      haha!rara!'; then in this example the two substrings are `rbar '
  1093.      and `rara!'.  The value is 2 because the first substring is greater
  1094.      at the second character.
  1095.  
  1096.           (compare-buffer-substring nil 6 11 nil 16 21)
  1097.                => 2
  1098.  
  1099. 
  1100. File: lispref.info,  Node: Insertion,  Next: Commands for Insertion,  Prev: Comparing Text,  Up: Text
  1101.  
  1102. Inserting Text
  1103. ==============
  1104.  
  1105.    "Insertion" means adding new text to a buffer.  The inserted text
  1106. goes at point--between the character before point and the character
  1107. after point.
  1108.  
  1109.    Insertion relocates markers that point at positions after the
  1110. insertion point, so that they stay with the surrounding text (*note
  1111. Markers::.).  When a marker points at the place of insertion, insertion
  1112. normally doesn't relocate the marker, so that it points to the
  1113. beginning of the inserted text; however, certain special functions such
  1114. as `insert-before-markers' relocate such markers to point after the
  1115. inserted text.
  1116.  
  1117.    Some insertion functions leave point before the inserted text, while
  1118. other functions leave it after.  We call the former insertion "after
  1119. point" and the latter insertion "before point".
  1120.  
  1121.    If a string with non-`nil' extent data is inserted, the remembered
  1122. extents will also be inserted.  *Note Duplicable Extents::.
  1123.  
  1124.    Insertion functions signal an error if the current buffer is
  1125. read-only.
  1126.  
  1127.    These functions copy text characters from strings and buffers along
  1128. with their properties.  The inserted characters have exactly the same
  1129. properties as the characters they were copied from.  By contrast,
  1130. characters specified as separate arguments, not part of a string or
  1131. buffer, inherit their text properties from the neighboring text.
  1132.  
  1133.  - Function: insert &rest ARGS
  1134.      This function inserts the strings and/or characters ARGS into the
  1135.      current buffer, at point, moving point forward.  In other words, it
  1136.      inserts the text before point.  An error is signaled unless all
  1137.      ARGS are either strings or characters.  The value is `nil'.
  1138.  
  1139.  - Function: insert-before-markers &rest ARGS
  1140.      This function inserts the strings and/or characters ARGS into the
  1141.      current buffer, at point, moving point forward.  An error is
  1142.      signaled unless all ARGS are either strings or characters.  The
  1143.      value is `nil'.
  1144.  
  1145.      This function is unlike the other insertion functions in that it
  1146.      relocates markers initially pointing at the insertion point, to
  1147.      point after the inserted text.
  1148.  
  1149.  - Function: insert-char CHARACTER COUNT &optional BUFFER
  1150.      This function inserts COUNT instances of CHARACTER into BUFFER
  1151.      before point.  COUNT must be a number, and CHARACTER must be a
  1152.      character.  The value is `nil'.  If optional argument BUFFER is
  1153.      `nil', the current buffer is assumed. (In FSF Emacs, the third
  1154.      argument is called INHERIT and refers to text properties.)
  1155.  
  1156.  - Function: insert-buffer-substring FROM-BUFFER-OR-NAME &optional
  1157.           START END
  1158.      This function inserts a portion of buffer FROM-BUFFER-OR-NAME
  1159.      (which must already exist) into the current buffer before point.
  1160.      The text inserted is the region from START and END.  (These
  1161.      arguments default to the beginning and end of the accessible
  1162.      portion of that buffer.)  This function returns `nil'.
  1163.  
  1164.      In this example, the form is executed with buffer `bar' as the
  1165.      current buffer.  We assume that buffer `bar' is initially empty.
  1166.  
  1167.           ---------- Buffer: foo ----------
  1168.           We hold these truths to be self-evident, that all
  1169.           ---------- Buffer: foo ----------
  1170.           
  1171.           (insert-buffer-substring "foo" 1 20)
  1172.                => nil
  1173.           
  1174.           ---------- Buffer: bar ----------
  1175.           We hold these truth-!-
  1176.           ---------- Buffer: bar ----------
  1177.  
  1178.